﻿$(document).ready(function () {
    
    $("#carousel").CloudCarousel(
		{
		    xPos: 128,
		    yPos: 32,
		    bringToFront: true,
		    autoRotate: 'yes',
		    reflOpacity: 0.4,
		    reflHeight: 30,
		    autoRotateDelay: 2000
		}
	);
    $(".button").click(validaLogin);
    $("#senha_login").mask("999.999.999-99");
    $(".cloudcarousel").bind('click', function () { window.open("Promocao.aspx?titulo=" + $(this).attr('title'), '_blank'); });    
});

function validaLogin() {
    $.ajax({
        type: 'POST',
        url: 'login.aspx/validaLogin',
        data: "{nome:'" + $("#nome_login").val() + "', cpf:'" + $("#senha_login").val() + "'}",
        dataType: 'json',
        contentType: "application/json; charset=utf-8",
        success: function (data) {
            if (data.d == "ok")
                window.location = "IndicacaoPremiada.aspx"
            else
                alert("Nome ou CPF incorretos");
        }
    });
}
